Skip to content

Conversation

@joschmitt
Copy link
Collaborator

I realized that I used @inferred wrong in the tests for #2196. Because of this, the tests didn't notice that exponent_vectors(Vector{UInt}, f) did not return Vector{UInt}s.

@joschmitt joschmitt added bugfix This change fixes an existing bug release notes: not needed PRs introducing changes that are wholly irrelevant to the release notes labels Nov 20, 2025
@joschmitt
Copy link
Collaborator Author

Yay, this is breaking now. It requires signatures exponent_vector(::Type{Vector{Int}}, ::MPoly, ::Int).
Is that fine? Or should I add some (temporary?) fallback to src/MPoly.jl?

@codecov
Copy link

codecov bot commented Nov 20, 2025

Codecov Report

❌ Patch coverage is 75.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.99%. Comparing base (7743f23) to head (6a4051d).

Files with missing lines Patch % Lines
src/MPoly.jl 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2221      +/-   ##
==========================================
- Coverage   88.00%   87.99%   -0.01%     
==========================================
  Files         127      127              
  Lines       31803    31807       +4     
==========================================
+ Hits        27989    27990       +1     
- Misses       3814     3817       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@thofma
Copy link
Member

thofma commented Nov 20, 2025

I would vote for the temporary fallback, but don't have a strong opinion.

@joschmitt
Copy link
Collaborator Author

I added a fallback, so this should not break anything anymore. Please review and merge :)

Comment on lines +135 to +136
function exponent_vector(::Type{Vector{S}}, a::MPoly{T}, i::Int) where {T <: RingElement, S}
e = Vector{S}(undef, nvars(parent(a)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems a bit unusual. I'd expect this to be either

Suggested change
function exponent_vector(::Type{Vector{S}}, a::MPoly{T}, i::Int) where {T <: RingElement, S}
e = Vector{S}(undef, nvars(parent(a)))
function exponent_vector(::Type{S}, a::MPoly{T}, i::Int) where {T <: RingElement, S}
e = S(undef, nvars(parent(a)))

(one could also restrict S to e.g. S <: Vector or S <: AbstractVetor)

Or else

Suggested change
function exponent_vector(::Type{Vector{S}}, a::MPoly{T}, i::Int) where {T <: RingElement, S}
e = Vector{S}(undef, nvars(parent(a)))
function exponent_vector(::Type{S}, a::MPoly{T}, i::Int) where {T <: RingElement, S}
e = Vector{S}(undef, nvars(parent(a)))

(and then change the callers to pass in just Int resp. eltype(someVectorType)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I intentionally did not implement the second option because there is/was this idea floating around that one should also be able to get the exponent vectors as ZZMatrix. Then I would find it inconsistent if there are exponent_vector(ZZRingElem, ...), which gives a Vector, and exponent_vector(ZZMatrix, ...).

I can implement the first variant. I might have preferred my version because it is easier to get the integer type that way, but I don't remember.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I'm wondering, is there a functional difference between ::Type{Vector{S}} where S and ::Type{S} where S <: Vector? As in, does one type get accepted by one but not the other?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not the same.

julia> f(::Type{Vector{S}}) where {S} = S
f (generic function with 1 method)

julia> g(::Type{S}) where {S <: Vector} = S
g (generic function with 1 method)

julia> f(Vector)
ERROR: MethodError: no method matching f(::Type{Vector})

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. That sounds to me like an argument not to change anything here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix This change fixes an existing bug release notes: not needed PRs introducing changes that are wholly irrelevant to the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants